package com.monitor.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.monitor.entity.ErpRefueling;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 加油记录表 Mapper 接口
 * </p>
 *
 * @author LX
 * @since 2018-09-13
 */
public interface ErpRefuelingMapper extends BaseMapper<ErpRefueling> {
	@Select("SELECT * from erp_refueling r where r.customer_id =#{custId} and r.ref_dt >= #{startTime} and r.ref_dt <= #{endTime}")
	public List<ErpRefueling> selectByCustId(@Param("custId")Integer custId,@Param("startTime")String startTime,@Param("endTime")String endTime);
	
	@Select("SELECT * from erp_refueling r where r.customer_id =#{custId} ${sql} order by r.ref_dt desc")
	public List<ErpRefueling> selectByCustId1(@Param("custId")Integer custId,@Param("sql")String sql);

	@Select("SELECT SUM(ref_total) FROM erp_refueling WHERE customer_id=#{customerId}")
	Double getRefuleMoneySum(@Param("customerId")Integer customerId);


}
